package com.lw.test;

/**
 * @Description: 超市
 * @author: 小雷
 * @createTime: 2025-02-13 17:41:29
 */
public class Supermarket {
    // 顾客 A 购买苹果和草莓的总价计算方法
    public double calculateTotalPriceForCustomerA(int appleQuantity, int strawberryQuantity) {
        Apple apple = new Apple();
        Strawberry strawberry = new Strawberry();
        return apple.calculateTotalPrice(appleQuantity) + strawberry.calculateTotalPrice(strawberryQuantity);
    }

    // 顾客 B 购买苹果、草莓和芒果的总价计算方法
    public double calculateTotalPriceForCustomerB(int appleQuantity, int strawberryQuantity, int mangoQuantity) {
        Apple apple = new Apple();
        Strawberry strawberry = new Strawberry();
        Mango mango = new Mango();
        return apple.calculateTotalPrice(appleQuantity) + strawberry.calculateTotalPrice(strawberryQuantity) + mango.calculateTotalPrice(mangoQuantity);
    }

    // 顾客 C 购买苹果、草莓（草莓打 8 折）和芒果的总价计算方法
    public double calculateTotalPriceForCustomerC(int appleQuantity, int strawberryQuantity, int mangoQuantity) {
        Apple apple = new Apple();
        Strawberry strawberry = new Strawberry();
        Mango mango = new Mango();
        return apple.calculateTotalPrice(appleQuantity) + strawberry.calculateDiscountedPrice(strawberryQuantity) + mango.calculateTotalPrice(mangoQuantity);
    }

    // 顾客 D 购买苹果、草莓（草莓打 8 折）和芒果，满 100 减 10 的总价计算方法
    public double calculateTotalPriceForCustomerD(int appleQuantity, int strawberryQuantity, int mangoQuantity) {
        double total = calculateTotalPriceForCustomerC(appleQuantity, strawberryQuantity, mangoQuantity);
        if (total >= 100) {
            total -= 10;
        }
        return total;
    }
}
